<template>
    <div class="school">
        <h2>名称：{{ name }}</h2>
        <h2>地址：{{ address }}</h2>
        <button @click="sendSchoolName">把学校名给App</button>
    </div>
</template>
<script>
export default {
    name: 'School',
    props: ['getSchoolName'],
    data() {
        return {
            name: '上海复旦',
            address: '上海',
        }
    },
    methods: {
        sendSchoolName() {
            this.getSchoolName(this.name)
        }
    }
}
</script>
<!-- 加上scoped属性，这个样式只作用于当前页面 -->
<style scoped>
.school {
    background-color: gray;
}
</style>